<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>模板明细</title>
    <script src="${ctx}/extends/jquery.min.js" type="text/javascript"></script>
    <#include "/pubHeadStyle.html">
</head>
<body>
<form class="layui-form" action="" lay-filter="templateDetail">
    <div style="position: relative;width: 98%">
        <div class="layui-form-item detail-form-item">
            <label class="layui-form-label detailLable">模板名称：</label>
            <div class="layui-input-block detailInput">
                <input type="text" name="name"  autocomplete="off" class="layui-input" readonly="readonly" />
            </div>
        </div>
        <div class="layui-form-item detail-form-item">
            <label class="layui-form-label detailLable">模板用途：</label>
            <div class="layui-input-block detailInput">
                <input type="text" name="useType"  autocomplete="off" class="layui-input" readonly="readonly" />
            </div>
        </div>
        <div class="layui-form-item detail-form-item">
            <label class="layui-form-label detailLable">是否默认：</label>
            <div class="layui-input-block detailInput">
                <input type="text" name="isDefault"  autocomplete="off" class="layui-input" readonly="readonly" />
            </div>
        </div>
        <div class="layui-form-item detail-form-item">
            <label class="layui-form-label detailLable">标题：</label>
            <div class="layui-input-block detailInput">
                <input type="text" name="title"  autocomplete="off" class="layui-input" readonly="readonly" />
            </div>
        </div>
        <div class="layui-form-item detail-form-item">
            <label class="layui-form-label detailLable">html内容：</label>
            <div class="layui-input-block detailInput">
                <input type="text" name="htmlContent"  autocomplete="off" class="layui-input" readonly="readonly" />
            </div>
        </div>
        <div class="layui-form-item detail-form-item">
            <label class="layui-form-label detailLable">普通内容：</label>
            <div class="layui-input-block detailInput">
                <input type="text" name="plainContent"  autocomplete="off" class="layui-input" readonly="readonly" />
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div style="text-align: center;position: absolute; bottom: 15px;width: 100%">
            <button type="reset" id="closeWindow" class="layui-btn btn-n layui-btn-danger btn-save">关闭</button>
        </div>
    </div>
</form>
<script>
    layui.config({
        base: serverPath.systemPath + staticPath.systemPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index','form','setter','element'], function () {
        var form = layui.form, setter = layui.setter
            ,element = layui.element ,$ = layui.$;

        var id = '${templateId}';
        $.ajax({
            url: serverPath.workflowPath  + setter.workflowLinkPath + "sysTemplate/get",
            type: "get",
            dataType: 'json',
            data: {templateId:id},
            success: function (data) {
                var returnDate = data.data;
                var isDefault = returnDate.isDefault;
                if(isDefault == 1){
                    isDefault = "是"
                }else {
                    isDefault = "否"
                };
                var useType = returnDate.useType;
                switch (useType) {
                    case 1:
                        useType = "终止提醒";
                        break;
                    case 2:
                        useType = "催办提醒";
                        break;
                    case 3:
                        useType = "审批提醒";
                        break;
                    case 4:
                        useType = "撤销提醒";
                        break;
                    case 5:
                        useType = "取消转办";
                        break;
                    case 6:
                        useType = "沟通提醒";
                        break;
                    case 7:
                        useType = "归档提醒";
                        break;
                    case 8:
                        useType = "转办提醒";
                        break;
                    case 9:
                        useType = "退回提醒";
                        break;
                    case 10:
                        useType = "沟通反馈";
                        break;
                    case 11:
                        useType = "取消代理";
                        break;
                    case 12:
                        useType = "抄送提醒";
                        break;
                    case 13:
                        useType = "流程节点无人员";
                        break;
                    case 19:
                        useType = "逾期提醒";
                        break;
                    case 22:
                        useType = "代理提醒";
                        break;
                    case 23:
                        useType = "消息转发";
                        break;
                    case 24:
                        useType = "重启任务";
                        break;
                    case 25:
                        useType = "通知任务所属人（代理）";
                        break;
                    case 26:
                        useType = "加签提醒";
                        break;
                    case 27:
                        useType = "加签反馈";
                        break;
                    case 28:
                        useType = "取消流转";
                        break;
                    case 29:
                        useType = "补签提醒";
                        break;
                }
                // $("[name='isDefault']").val(isDefault)
                form.val('templateDetail',
                    {
                        "templateId": returnDate.templateId,
                        "name": returnDate.name,
                        "useType": useType,
                        "isDefault": isDefault,
                        "title": returnDate.title,
                        "htmlContent": returnDate.htmlContent,
                        "plainContent": returnDate.plainContent
                    })
            }
        });

        //关闭当前页面
        $("#closeWindow").click(function () {
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        })
    })
</script>
</body>
</html>